<template>
  <div id="Demo" class="ml-1">
    <TinymceKH ref="TinymceKHS" height="99vh" width="99%"/>
  </div>
</template>
<script>
  // import { mapState, mapMutations, mapActions } from 'vuex'
  // import validMixins from '@/mixins/validMixins.js'
  export default {
    name: 'Demo',
    components: {
      // TablesGZCJ,
    },
    // mixins: [validMixins],
    props: {
      // treeData: Array,
    },
    // mixins: [validMixins],
    data() {
      return {
        htmlContent: ""
      }
    },
    computed: {
      // ...mapState('user', ['token', 'userInfo'])
    },
    watch: {
      // 'cmAddForm.enginePlatform': function(val) {
      //   console.log('enginePlatformval', val)
      //   if (val) {
      //     this.emissionOptionReq()
      //   }
      // }
    },
    created() {

    },
    mounted() {
      this.testReq();
    },
    methods: {
      testReq() {
        this.$axiosReq({
          baseURL: "http://vhs-wx.intranet.ruixiude.com:15980",
          url: '/vhg-api/rxd-business-wkt/article/256422840910213120',
          method: 'get', bfLoading: true, isUploadFile: true
        }).then(res => {
          this.htmlContent = this.showHtml(res.data.content);
          this.sleepMixin(100).then(()=>{
            this.$refs.TinymceKHS.setValue(this.htmlContent)
          })
        })
      },
      showHtml(str) {
        return str
          .replace(str ? /&(?!#?\w+;)/g : /&/g, '&amp;')
          .replace(/&lt;/g, "<")
          .replace(/&gt;/g, ">")
          .replace(/&quot;/g, "\"")
          .replace(/&#39;/g, "\'")
          .replace(/&amp;nbsp;/g, '\u3000')
      },

      tangKuang() {
        this.$dialog.alert({
          message: '弹窗内容',
        });
      },
      loadingTest() {
        this.$toast.loading({
          message: '加载中',
          forbidClick: true,
          loadingType: 'spinner'
        });
      },
      toastTest() {
        this.$toast({
          type: "success",
          message: "aaa",
          duration: "2000",
          forbidClick: true,
          overlay: false,
        });
      },
      toastFail() {
        this.vantToastNoneMixin("aa");
        // this.vantLoadingMixin();
        // this.vantConfirmNoCancelBtnMixin();
        // this.vantAlterMixin();
      },
      toastNOne() {
        this.$toast("失败");
      },
      dialogConfirm() {
        this.$dialog.confirm({
          title: '标题',
          message: '弹窗内容',
        })
          .then(() => {
            // on confirm
          })
          .catch(() => {
            // on cancel
          });
      },
      dialogAlert() {
        this.$dialog.alert({
          title: '标题',
          message: '弹窗内容',
          theme: 'round-button',
        }).then(() => {
          // on close
        });
      },
      // ...mapActions('user', ['closeSideBar']),
      // ...mapMutations('user', ['CHAGE_TOKEN']),
      vuexTest() {
        this.$store.commit('test/M_industry', 'TestIndex')
      },
      routerPush() {
        const urlData = {
          params: {name: '邝华'},
          from: 'Demo'
        }
        this.routerPushMixin('Demo2', urlData)
      }
    },
    activated() {
      console.log(this.$store.state.generalState.cachedViews);
      console.log('加入keepalive中生效')
    },
    deactivated() {

      console.log('加入keepalive中生效')
    },
    destroyed(){

    }
  }
</script>

<style lang="scss">
  .demo1 {
    width: 740px;
    background-color: red;
    font-size: 32px;
  }



  /*#Demo {*/

  /*}*/
</style>

